package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.client.Nacos01Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 课工场
 * @since 2023/9/7
 */
@RestController
@RequestMapping("nacos02")
@RefreshScope
public class NacosClient02Controller {

    @Autowired
    private Nacos01Client nacos01Client;

    @Value("${age}")
    private Integer age;

    @GetMapping("m1")
    public String method1(){
        String s = nacos01Client.method1();
        return "NacosClient02 ok >> result = " +s;
    }

    @GetMapping("m2")
    public String method2(){

        return "NacosClient02 ok >> age = "+age;
    }

}
